ApplicationPermissions
PERMISSIONS.md
ProjectSardine Permissions System
This document describes the structure and usage of the permission system used in the ProjectSardine API. The system categorizes permissions under several groups and uses static string constants annotated with Description attributes for display purposes.
📦 Permission Structure
Permissions are defined in a static class AppPerms under the namespace:
ProjectSardine.Api.ApplicationPermissions.Services
Each permission group is a nested static class with string constants representing each permission.
🧾 Permission Groups & Permissions
🔐 Accounts — صلاحيات الحسابات
| Key | Description |
|---|---|
Accounts.AddAccount | إضافة حساب جديد |
Accounts.GetAccounts | عرض قائمة الحسابات |
Accounts.UpdateAccount | تحديث الحساب |
Accounts.DeleteAccount | حذف الحساب |
🪟 Windows — صلاحيات الواجهات
| Key | Description |
|---|---|
Windows.MonitorWindow | الدخول الى واجهة المراقبة |
Windows.Restaurant | واجهة المطعم |
Windows.ProductsWindow | واجهة المنتجات |
Windows.Management | واجهة الادارة |
Windows.Reports | واجهة التقارير |
Windows.Finance | واجهة المالية |
Windows.Settings | واجهة الاعدادات |
🔁 Transactions — صلاحيات المعاملات
| Key | Description |
|---|---|
Transactions.AddExpense | إضافة سند صرف |
Transactions.GetExpenses | عرض سند صرف |
Transactions.DeleteExpense | حذف سند صرف |
Transactions.AddPayment | إضافة سند دفع |
Transactions.GetPayments | عرض سند دفع |
Transactions.DeletePayment | حذف سند دفع |
Transactions.AddReceipt | إضافة سند قبض |
Transactions.GetReceipts | عرض سند قبض |
Transactions.DeleteReceipt | حذف سند قبض |
Transactions.Print | طباعة السندات |
🖨️ Printers — الطابعات
| Key | Description |
|---|---|
Printers.FullPrinterPermissions | تحكم كامل في الطابعات |
🍽️ Products — صلاحيات المنتجات
| Key | Description |
|---|---|
Products.CookedItemsAccess | الدخول إلى العناصر المطبوخة |
Products.AddCookedItem | إضافة أكلة في العناصر المطبوخة |
Products.DeleteCookedItem | حذف أكلة في العناصر المطبوخة |
Products.UpdateCookedItem | تعديل أكلة في العناصر المطبوخة |
Products.ManageGroups | التحكم بالمجموعات |
Products.ReadyToSellItems | العناصر الجاهزة للبيع |
Products.BasicIngredeints | المواد الأولية |
🍴 Restaurant — صلاحيات المطعم
| Key | Description |
|---|---|
Restaurant.ManageKitchens | التحكم بالمطابخ |
Restaurant.ManageHalls | التحكم بالقاعات |
Restaurant.ManageTables | التحكم بالطاولات |
Restaurant.ManageDeliveryAdmin | التحكم بالتوصيل (الإدارة) |
Restaurant.ManageSettings | التحكم بالإعدادات |
👀 Monitor — صلاحيات المراقبة
| Key | Description |
|---|---|
Monitor.DecreaseAfterPrint | إنقاص العدد بعد الطباعة للمطبخ |
Monitor.DeleteAfterPrint | حذف مادة من القائمة بعد الطباعة للمطبخ |
Monitor.ChangeMealPrice | تغيير سعر الأكلة |
Monitor.SaveAndPrintToKitchen | حفظ وطباعة للمطبخ سفري/صالة |
Monitor.PrintCustomerBill | طباعة الحساب للزبون سفري/صالة |
Monitor.MoveOrder | نقل الطلب بين الطاولات |
Monitor.CancelOrder | حذف الطلب أو الإلغاء |
Monitor.AddCustomer | إضافة زبون جديد |
Monitor.NotPayedFullyInAdvanced | البيع بالآجل للزبائن |
Monitor.AddDiscount | اضافة خصم |
Monitor.HandleDeliveryOrders | التعامل مع طلبات السفري |
🛠️ Services & Utilities
AppPermsService
GetAllPermissions()— Returns a grouped list of permissions with descriptions.GetAllPermissionsList()— Returns a flat list of all permission keys.- Uses
DescriptionAttributeto fetch display-friendly text for each permission.
PermissionsManager
-
Handles database and cache-level interactions for permission checks.
-
Key methods:
GetAllPermissionsFromDbAsyncGetPermissionsForUserGetRolePermissionsHasPermission
📌 Notes
PermissionsEntityholds a permission entry associated with a RoleId.- Permissions are typically assigned per role and cached for performance.
- Use the
Descriptionattribute for multilingual or friendly UI display.